﻿<phone:PhoneApplicationPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
                            mc:Ignorable="d"
                            d:DesignWidth="480"
                            d:DesignHeight="800"
                            x:Class="PostIt.MainPage"
                            d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
                            SupportedOrientations="Portrait"
                            Orientation="Portrait"
                            shell:SystemTray.IsVisible="True"
                            BackKeyPress="PhoneApplicationPage_BackKeyPress_1">
    <phone:PhoneApplicationPage.Resources>
        <Style x:Key="ListBoxItemStyle1"
               TargetType="ListBoxItem">
            <Setter Property="Background"
                    Value="Transparent" />
            <Setter Property="BorderThickness"
                    Value="0" />
            <Setter Property="BorderBrush"
                    Value="Transparent" />
            <Setter Property="Padding"
                    Value="0" />
            <Setter Property="HorizontalContentAlignment"
                    Value="Left" />
            <Setter Property="VerticalContentAlignment"
                    Value="Top" />
        </Style>
        <Style x:Key="ListBoxItemStyle2" TargetType="ListBoxItem">
        	<Setter Property="Background" Value="Transparent"/>
        	<Setter Property="BorderThickness" Value="0"/>
        	<Setter Property="BorderBrush" Value="Transparent"/>
        	<Setter Property="Padding" Value="0"/>
        	<Setter Property="HorizontalContentAlignment" Value="Left"/>
        	<Setter Property="VerticalContentAlignment" Value="Top"/>
        	<Setter Property="Template">
        		<Setter.Value>
        			<ControlTemplate TargetType="ListBoxItem">
        				<Border x:Name="LayoutRoot" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
        					<VisualStateManager.VisualStateGroups>
        						<VisualStateGroup x:Name="CommonStates">
        							<VisualStateGroup.Transitions>
        								<VisualTransition GeneratedDuration="0:0:0.5">
        									<Storyboard>
        										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="ContentContainer">
        											<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
        											<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
        										</DoubleAnimationUsingKeyFrames>
        										<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="ContentContainer">
        											<EasingDoubleKeyFrame KeyTime="0" Value="30"/>
        											<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
        										</DoubleAnimationUsingKeyFrames>
        									</Storyboard>
        								</VisualTransition>
        								<VisualTransition GeneratedDuration="0:0:0.5" To="Normal"/>
        							</VisualStateGroup.Transitions>
        							<VisualState x:Name="Normal"/>
        							<VisualState x:Name="MouseOver"/>
        							<VisualState x:Name="Disabled">
        								<Storyboard>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="LayoutRoot">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        									<DoubleAnimation Duration="0" To=".5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
        								</Storyboard>
        							</VisualState>
        						</VisualStateGroup>
        						<VisualStateGroup x:Name="SelectionStates">
        							<VisualState x:Name="Unselected"/>
        							<VisualState x:Name="Selected">
        								<Storyboard>
        									<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
        										<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneAccentBrush}"/>
        									</ObjectAnimationUsingKeyFrames>
        								</Storyboard>
        							</VisualState>
        						</VisualStateGroup>
        						<VisualStateGroup x:Name="FocusStates"/>
        					</VisualStateManager.VisualStateGroups>
        					<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" RenderTransformOrigin="0.5,0.5">
        						<ContentControl.Projection>
        							<PlaneProjection/>
        						</ContentControl.Projection>
        						<ContentControl.RenderTransform>
        							<CompositeTransform/>
        						</ContentControl.RenderTransform>
        					</ContentControl>
        				</Border>
        			</ControlTemplate>
        		</Setter.Value>
        	</Setter>
        </Style>
    </phone:PhoneApplicationPage.Resources>

    <phone:PhoneApplicationPage.FontFamily>
        <StaticResource ResourceKey="PhoneFontFamilyNormal" />
    </phone:PhoneApplicationPage.FontFamily>
    <phone:PhoneApplicationPage.FontSize>
        <StaticResource ResourceKey="PhoneFontSizeNormal" />
    </phone:PhoneApplicationPage.FontSize>
    <phone:PhoneApplicationPage.Foreground>
        <StaticResource ResourceKey="PhoneForegroundBrush" />
    </phone:PhoneApplicationPage.Foreground>

    <!--Data context is set to sample data above and LayoutRoot contains the root grid where all other page content is placed-->
    <Grid x:Name="LayoutRoot"
          Background="Transparent">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel"
                    Grid.Row="0"
                    Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle"
                       Text="POST IT"
                       Style="{StaticResource PhoneTextNormalStyle}" />
        </StackPanel>

        <!--ContentPanel contains ListBox and ListBox ItemTemplate. Place additional content here-->
        <Grid x:Name="ContentPanel"
              Grid.Row="1"
              Margin="12,0,12,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="0*" />
            </Grid.ColumnDefinitions>
            <ListBox x:Name="MainListBox"
                     Margin="11,0,0,0"
                     ItemsSource="{Binding Items}"
                     SelectionChanged="MainListBox_SelectionChanged"
                     ItemContainerStyle="{StaticResource ListBoxItemStyle2}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid  Height="157"
                               Margin="0,0,0,17"
                               Width="432"
                               CacheMode="BitmapCache">
                            <Rectangle Fill="{Binding BackColor}"
                                       HorizontalAlignment="Left"
                                       Margin="9,4,0,10"
                                       Stroke="Black"
                                       Width="413"
                                       StrokeThickness="0"
                                       RadiusY="10"
                                       RadiusX="10" />
                            <TextBlock Text="{Binding tileText}"
                                       TextWrapping="Wrap"
                                       Style="{StaticResource PhoneTextExtraLargeStyle}"
                                       Margin="19,14,237,93"
                                       FontSize="33.333" />
                            <TextBlock Text="{Binding DueDate}"
                                       TextWrapping="Wrap"
                                       Margin="304,127,28,10"
                                       Style="{StaticResource PhoneTextSubtleStyle}"
                                       FontSize="14.667"
                                       Foreground="#EE2B2627" />
                            <TextBlock Text="{Binding Title}"
                                       TextWrapping="Wrap"
                                       Margin="21,69,28,35"
                                       Style="{StaticResource PhoneTextSubtleStyle}"
                                       Foreground="Black" />



                            <Rectangle HorizontalAlignment="Left"
                                       Margin="9,4,0,10"
                                       Stroke="Black"
                                       Width="413"
                                       StrokeThickness="0"
                                       RadiusY="10"
                                       RadiusX="10"
                                       Opacity="{Binding rectOpa}"
                                       Fill="#FF060001" />
                            <Image Name="pin"
                                   Tag="{Binding TaskId}"
                                   Margin="356,16,28,93"
                                   Source="{Binding isPinImgAdr}"
                                   Stretch="Fill"
                                   Tap="Image_Tap_1"
                                   Width="48"
                                   Height="48" />
                            <Image Tag="{Binding TaskId}"
                                   Name="view"
                                   Margin="304,16,80,93"
                                   Source="/icons/view.png"
                                   Stretch="Fill"
                                   Width="48"
                                   Height="48"
                                   Tap="view_Tap" />


                            <Image Tag="{Binding TaskId}"
                                   Name="doneButton"
                                   Margin="252,16,132,93"
                                   Source="{Binding isDoneImgAdr}"
                                   Stretch="Fill"
                                   Width="48"
                                   Height="48"
                                   Tap="doneButton_Tap" />
                            <Image Tag="{Binding TaskId}"
                                   x:Name="deleteButton"
                                   Margin="201,17,183,92"
                                   Source="/icons/close.png"
                                   Stretch="Fill"
                                   Width="48"
                                   Height="48"
                                   Tap="deleteButton_Tap" />
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True"
                              IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/icons/appbar.new.rest.png"
                                            Text="Add"
                                            Click="ApplicationBarIconButton_Click_1" />


            <!--<shell:ApplicationBarMenuItem Text="MenuItem 1" />-->

            <!--</shell:ApplicationBar.MenuItems>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
